.class public Lcom/instagram/pendingmedia/b/a;
.super Ljava/lang/Object;
.source "PendingMediaStore.java"


# static fields
.field private static b:Lcom/instagram/pendingmedia/b/a;


# instance fields
.field final a:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/instagram/pendingmedia/model/c;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method private constructor <init>()V
    .locals 1

    .prologue
    .line 50
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 51
    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    iput-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    .line 52
    return-void
.end method

.method public static a()Lcom/instagram/pendingmedia/b/a;
    .locals 1

    .prologue
    .line 36
    sget-object v0, Lcom/instagram/pendingmedia/b/a;->b:Lcom/instagram/pendingmedia/b/a;

    if-nez v0, :cond_0

    .line 37
    invoke-static {}, Lcom/instagram/pendingmedia/b/a;->f()V

    .line 39
    :cond_0
    sget-object v0, Lcom/instagram/pendingmedia/b/a;->b:Lcom/instagram/pendingmedia/b/a;

    return-object v0
.end method

.method private static declared-synchronized f()V
    .locals 2

    .prologue
    .line 43
    const-class v1, Lcom/instagram/pendingmedia/b/a;

    monitor-enter v1

    :try_start_0
    sget-object v0, Lcom/instagram/pendingmedia/b/a;->b:Lcom/instagram/pendingmedia/b/a;

    if-nez v0, :cond_0

    .line 44
    new-instance v0, Lcom/instagram/pendingmedia/b/a;

    invoke-direct {v0}, Lcom/instagram/pendingmedia/b/a;-><init>()V

    sput-object v0, Lcom/instagram/pendingmedia/b/a;->b:Lcom/instagram/pendingmedia/b/a;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 46
    :cond_0
    monitor-exit v1

    return-void

    .line 43
    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method


# virtual methods
.method public a(Ljava/lang/String;)Lcom/instagram/pendingmedia/model/c;
    .locals 1
    .parameter

    .prologue
    .line 61
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    return-object v0
.end method

.method public a(Lcom/instagram/pendingmedia/b/b;)Ljava/util/List;
    .locals 5
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/instagram/pendingmedia/b/b;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/instagram/pendingmedia/model/c;",
            ">;"
        }
    .end annotation

    .prologue
    .line 133
    new-instance v1, Ljava/util/ArrayList;

    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->size()I

    move-result v0

    invoke-direct {v1, v0}, Ljava/util/ArrayList;-><init>(I)V

    .line 134
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 135
    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v3

    sget-object v4, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-ne v3, v4, :cond_0

    .line 136
    sget-object v3, Lcom/instagram/pendingmedia/b/b;->a:Lcom/instagram/pendingmedia/b/b;

    if-ne p1, v3, :cond_1

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->M()Z

    move-result v3

    if-nez v3, :cond_2

    :cond_1
    sget-object v3, Lcom/instagram/pendingmedia/b/b;->b:Lcom/instagram/pendingmedia/b/b;

    if-ne p1, v3, :cond_0

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->M()Z

    move-result v3

    if-nez v3, :cond_0

    .line 138
    :cond_2
    invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 142
    :cond_3
    return-object v1
.end method

.method public a(Ljava/lang/String;Lcom/instagram/pendingmedia/model/c;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 71
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0, p1, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 72
    invoke-virtual {p0}, Lcom/instagram/pendingmedia/b/a;->e()V

    .line 73
    return-void
.end method

.method a(Ljava/util/List;)V
    .locals 4
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/instagram/pendingmedia/model/c;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 76
    invoke-interface {p1}, Ljava/util/List;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_1

    .line 77
    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 78
    iget-object v2, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->a()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v2, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0

    .line 80
    :cond_0
    invoke-virtual {p0}, Lcom/instagram/pendingmedia/b/a;->e()V

    .line 82
    :cond_1
    return-void
.end method

.method public b()V
    .locals 5

    .prologue
    .line 107
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    .line 109
    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 110
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 111
    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/instagram/pendingmedia/model/c;

    invoke-virtual {v1}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v1

    sget-object v3, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-eq v1, v3, :cond_0

    .line 112
    const-string v1, "PendingMediaStore"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Deleting media"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 113
    invoke-interface {v2}, Ljava/util/Iterator;->remove()V

    goto :goto_0

    .line 116
    :cond_1
    return-void
.end method

.method public b(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 90
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 92
    if-eqz v0, :cond_0

    .line 93
    invoke-virtual {p0}, Lcom/instagram/pendingmedia/b/a;->e()V

    .line 95
    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->q()Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_0

    .line 98
    new-instance v1, Ljava/io/File;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->q()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v1, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/File;->deleteOnExit()V

    .line 101
    :cond_0
    return-void
.end method

.method public c()Ljava/util/Set;
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Set",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 119
    new-instance v1, Ljava/util/HashSet;

    invoke-direct {v1}, Ljava/util/HashSet;-><init>()V

    .line 120
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 121
    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->I()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 124
    :cond_0
    return-object v1
.end method

.method public d()Lcom/instagram/pendingmedia/model/c;
    .locals 5

    .prologue
    .line 161
    const/4 v1, 0x0

    .line 162
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 163
    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->c()Lcom/instagram/model/a/a;

    move-result-object v3

    sget-object v4, Lcom/instagram/model/a/a;->b:Lcom/instagram/model/a/a;

    if-ne v3, v4, :cond_1

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v3

    sget-object v4, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    if-eq v3, v4, :cond_1

    :goto_1
    move-object v1, v0

    .line 167
    goto :goto_0

    .line 168
    :cond_0
    return-object v1

    :cond_1
    move-object v0, v1

    goto :goto_1
.end method

.method public e()V
    .locals 5

    .prologue
    .line 172
    const-string v0, "PendingMediaStore.INTENT_ACTION_PENDING_MEDIA_CHANGED"

    invoke-static {v0}, Lcom/instagram/n/d;->a(Ljava/lang/String;)Z

    .line 174
    invoke-static {}, Lcom/instagram/i/a;->b()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 175
    const-string v0, "PendingMediaStore"

    const-string v1, "%s entries in PendingMediaStore"

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    iget-object v4, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v4}, Ljava/util/Map;->size()I

    move-result v4

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v2, v3

    invoke-static {v1, v2}, Lcom/facebook/c/i/b;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 177
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 178
    const-string v2, "PendingMediaStore"

    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v2, v0}, Lcom/facebook/e/a/a;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 181
    :cond_0
    return-void
.end method
